package com.demo.controller;


import com.demo.entity.EquipmentData;
import com.demo.entity.ResModel;
import com.demo.service.EquipmentDataService;
import com.rfid.bean.OutputDataInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 设备数据表 前端控制器
 * </p>
 *
 * @author 马磊
 * @since 2023-02-02
 */
@RestController
@RequestMapping("/demo/equipment")
public class EquipmentDataController {

    @Autowired
    private EquipmentDataService equipmentDataService;


    @ApiOperation("分页查询设备列表")
    @GetMapping("/list/{current}/{size}")
    public ResModel listByPage(@PathVariable Integer current, @PathVariable Integer size, EquipmentData equipmentData){
        return equipmentDataService.listByPage(current,size,equipmentData);
    }

    @ApiOperation("根据id删除")
    @DeleteMapping("/{id}")
    public ResModel deleteData(@PathVariable Integer id){
        return equipmentDataService.deleteData(id);
    }

    @ApiOperation("批量删除")
    @PostMapping(path = "/all",produces = "application/json")
    public ResModel delAllData(@RequestBody List<Integer> ids){
        return equipmentDataService.delAllData(ids);
    }

    @ApiOperation("导出数据")
    @GetMapping("/export")
    public void exportData(HttpServletResponse response) throws Exception {
        equipmentDataService.exportData(response);
    }

}

